# $Id: PKGBUILD 72637 2012-06-18 09:24:39Z spupykin $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>

pkgname=remmina
pkgver=1.0.0
pkgrel=9
pkgdesc="remote desktop client written in GTK+"
arch=(i686 x86_64)
url="http://remmina.sourceforge.net/"
license=('GPL')
depends=('gtk3' 'zlib' 'libjpeg' 'libssh' 'libunique' 'avahi' 'vte3' 'libgcrypt' 'libxdmcp')
makedepends=('intltool' 'pkgconfig' 'cmake' 'libgnome-keyring'
	     'avahi' 'libxkbfile' 'freerdp' 'telepathy-glib')
optdepends=('libxkbfile'
	    'freerdp'
	    'telepathy-glib'
	    'gnome-keyring')
replaces=('remmina-plugins')
provides=('remmina-plugins')
install=remmina.install
source=("https://github.com/downloads/FreeRDP/Remmina/Remmina-$pkgver.tar.gz"
	'https://github.com/FreeRDP/Remmina/commit/569d9bb7.patch'
	'https://github.com/FreeRDP/Remmina/commit/f7d1038b.patch'
	'https://github.com/FreeRDP/Remmina/commit/1aebfc02.patch'
	'https://github.com/FreeRDP/Remmina/commit/3ebdd6e7.patch'
	'https://github.com/FreeRDP/Remmina/commit/97c2af8c.patch'
	'https://github.com/FreeRDP/Remmina/commit/84327f81.patch'
	'https://github.com/FreeRDP/Remmina/commit/c1ef3a16.patch'
	'https://github.com/FreeRDP/Remmina/commit/6ee20289.patch'
	'https://github.com/FreeRDP/Remmina/commit/b2277827.patch'
	'https://github.com/FreeRDP/Remmina/commit/cb0b209b.patch')
md5sums=('701c540acaab961bc3adf130a2ddb8b1'
         '23927a584c23d0da7a893c1f39d53857'
         '40f5ce2f30c8ce8ae8a4ebcee52874ab'
         'c842ba295c2327ab4d0819fc4a5bc03f'
         '9312b5bf953a63e6203f0d0be6cb8134'
         '65bfcc39ae51343b90928ea329cc4900'
         '42b971116f887657fc210da70c3afba5'
         '04b5bc1190b53211747e097897d1d19c'
         'ce0b538ff850556b2ad8fc4e4736039e'
         '3bc1a4e50cdd864c0e2d7c91a1e02e32'
         'b9023ea4f36c31c3d4e98cfc472c1a09')

build() {
  cd ${srcdir}/FreeRDP-Remmina-*/

  for i in ${source[@]}; do
    if [ ${i:(-6)} == ".patch" ]; then
      patch -p1 -i "${srcdir}/${i:(-14)}"
    fi
  done

  export LDFLAGS="-lX11 -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lpthread -lgnutls"
  cmake -DCMAKE_INSTALL_PREFIX=/usr -DWITH_APPINDICATOR=OFF .
  make
}

package() {
  cd ${srcdir}/FreeRDP-Remmina-*/
  make DESTDIR=${pkgdir} install
}
